/*
 * Copyright Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
@use "sass:color";
@import "../../global/common";

$global-icon-size: 16px;
$btn-group-border-radius: $global-border-radius;
$console-icon-background: #474747;
$console-icon-color: #fff;

.btn-icon {
  border: 1px solid $border-color;
  border-radius: $global-border-radius;
  cursor: pointer;
  font-size: $global-icon-size;
  padding: 0 10px;
  height: $form-element-height;
  flex: 0 1 auto;
  color: $icon-color;
  transition: $transition;
  background: $icon-bg;

  &:hover {
    color: color.adjust($icon-color, $lightness: 100%);
    transition: $transition;
    background: $icon-color;
  }

  &:focus,
  &:active {
    outline: 0;
  }
}

.disabled {
  opacity: 0.75;
  cursor: not-allowed;

  &:hover {
    color: $icon-color;
    background: $icon-bg;
  }
}

.enabled {
  cursor: pointer;
}

.settings {
  @include icon-before($type: $fa-var-gear);
}

.analytics {
  @include icon-before($type: $fa-var-chart-bar);
}

.edit {
  @include icon-before($type: $fa-var-edit);
}

.view {
  @include icon-before($type: $fa-var-eye);
}

.clone {
  @include icon-before($type: $fa-var-clone);
}

// delete is a keyword, a literal syntax; can't be accessed using styles.delete hence renaming it to remove
.remove {
  @include icon-before($type: $fa-var-trash-can);
}

.lock {
  @include icon-before($type: $fa-var-lock);
}

.close {
  @include icon-before($type: $fa-var-xmark);
}

.question {
  @include icon-before($type: $fa-var-question);
}

.check {
  @include icon-before($type: $fa-var-check);
}

.spinner {
  animation: spin 1500ms linear infinite;

  @include icon-before($type: $fa-var-spinner);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.refresh {
  @include icon-before($type: $fa-var-sync);
}

.usage {
  @include icon-before($type: $fa-var-chart-pie);
}

.minus {
  font-size: 7px;

  @include icon-before($type: $fa-var-minus);
}

.plus {
  @include icon-before($type: $fa-var-plus);
}

.search {
  @include icon-before($type: $fa-var-search);
}

.info-circle {
  @include icon-before($type: $fa-var-info-circle);
}

.question-circle {
  @include icon-before($type: $fa-var-question-circle);
}

.caret-down {
  @include icon-before($type: $fa-var-caret-down);
}

.caret-right {
  @include icon-before($type: $fa-var-caret-right);
}

.step-forward {
  @include icon-before($type: $fa-var-step-forward);
}

.forward {
  @include icon-before($type: $fa-var-forward);
}

.download {
  @include icon-before($type: $fa-var-download);
}

.chevron-right {
  @include icon-before($type: $fa-var-chevron-right);
}

.chevron-down {
  @include icon-before($type: $fa-var-chevron-down);
}

.chevron-right-round {
  @include icon-before($type: $fa-var-arrow-alt-circle-right);
}

.trigger {
  @include icon-before($type: $fa-var-play);
}

.repeat {
  @include icon-before($type: $fa-var-rotate-right);
}

.comment {
  @include icon-before($type: $fa-var-comment);
}

.warning {
  @include icon-before($type: $fa-var-exclamation-triangle);
}

.angle-double-right {
  @include icon-before($type: $fa-var-angle-double-right);
}

.cancel-stage {
  @include icon-before($type: $fa-var-ban);
}

.console-log {
  @include icon-before($type: $fa-var-terminal);

  &::before {
    border: 1px solid $console-icon-background;
    padding: 3px;
    border-radius: 3px;
    background: $console-icon-background;
    color: $console-icon-color;
    font-weight: 800;
  }

  &:hover::before {
    transition: 0.4s;
    background: $console-icon-color;
    color: $console-icon-background;
  }
}

.list {
  @include icon-before($type: $fa-var-list);
}

.icon-group {
  border: 1px solid $border-color;
  border-radius: $btn-group-border-radius;
  display: inline-flex;

  .btn-icon {
    border: none;
    border-left: 1px solid $border-color;
    border-radius: 0;

    &:first-child {
      border-left: none;
      border-radius: $btn-group-border-radius 0 0 $btn-group-border-radius;
    }

    &:last-child {
      border-radius: 0 $btn-group-border-radius $btn-group-border-radius 0;
    }
  }
}
